<div class="view">

	<?php
	$htmlOptions = array(
		'name'=>"answer-$data->id",
	);
	echo CHtml::link('', '', $htmlOptions);
	?>
	
	<table class="collapse">
		<tr>
			<td class="top">

				<div class="span-3">
					<?php
					$default = Yii::app()->request->hostInfo;
					$default .= Yii::app()->getModule('qa')->assetsUrl;
					$default .= '/images/gravatar-110.png';
					$firstname = $data->creator->profile->firstname;
					$config = array(
						'email'=>$data->creator->email,
						'hashed'=>false,
						'default'=>$default,
						'size'=>110,
						'rating'=>'PG',
						'htmlOptions'=>array(
							'alt'=>"$firstname Avatar",
							'title'=>CHtml::encode($firstname),
							'class'=>'round stroke',
						),
					);
					$this->widget('qa.widgets.GravatarWidget', $config);
					?>
					<div class="center">
						<?php
						echo CHtml::encode($firstname);
						?>
					</div>
				</div>

				<div class="clear"></div>

			</td>

			<td class="full top">

				<div class="small bottom right prepend-1 negative">
					<?php
					echo Yii::app()->dateformatter->formatDateTime(
						$data->unixCreatedAt, 'full', 'short'
					);
					?>
				</div>

				<div>
					<?php
					$properties = array('purifyOutput'=>true);
					$this->beginWidget('CMarkdown', $properties);
					echo $data->value;
					$this->endWidget();
					?>
				</div>

				<div class="clear"></div>

				<?php $user = Yii::app()->user; ?>
				<?php if (!$user->isGuest): ?>
					<div class="right">
						<?php
						if ($user->id == 1 || $user->id == $data->createdBy) {
							$url = array('answer/update', 'id'=>$data->id);
							$htmlOptions = array(
								'class'=>'button negative round'
							);
							echo CHtml::link('Update', $url, $htmlOptions);
						}

						$htmlOptions = array(
							'rel'=>$data->id,
							'class'=>'reply button positive round last',
						);
						echo CHtml::link('Reply', '#', $htmlOptions);
						?>
					</div>
				<?php endif; ?>

				<div class="clear"></div>
			</td>
		</tr>
	</table>

</div>